package com.onlyMe.view.world.objects
{
	import com.onlyMe.base.BasicEntity;
	import com.onlyMe.globals.libs;
	import com.onlyMe.world.objects.IsleObject;
	
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	
	public final class IsleObjectView extends BasicEntity
	{
		private static const OBJECT_PACK:String = 'assets';
		
		private var _object:IsleObject;
		private var _container:Sprite;
		
		public function IsleObjectView(object:IsleObject, container:Sprite)
		{
			super(object.type + 'View');
			
			_object = object;
			_container = container;
			
			init();
		}

		private function init():void
		{
			libs.fetchObject(object.type, assetReady);
		}
		
		private function assetReady(obj:DisplayObject):void
		{
			container.addChild(obj);
		}

		public function get object():IsleObject
		{
			return _object;
		}
		
		public function get container():Sprite
		{
			return _container;
		}

	}
}